package com.shsh.safemanage.util;

import java.util.Locale;
import java.util.ResourceBundle;

public class MessageUtil {
	public static String getMessage(String key) {
		if (key == null) {
			return "";
		}
		
		ResourceBundle bundle = ResourceBundle.getBundle("Messages", Locale.SIMPLIFIED_CHINESE);
		try {
			String str = bundle.getString(key);
			if (str == null) {
				return "!" + key + "!";
			}
			
			return str;
		} catch (Exception e) {
			e.printStackTrace();
			return "!!" + key + "!!";
		}
	}
	
	public static String getLabel(String key) {
		if (key == null) {
			return "";
		}
		
		ResourceBundle bundle = ResourceBundle.getBundle("Label", Locale.SIMPLIFIED_CHINESE);
		try {
			String str = bundle.getString(key);
			if (str == null) {
				return "!" + key + "!";
			}
			
			return str;
		} catch (Exception e) {
			e.printStackTrace();
			return "!!" + key + "!!";
		}
	}
}
